const express = require('express');
const fileExplorer = require('./utils/fileExplorer');

const app = express();
const port = 3000;

app.get('/', (req, res) => {
  res.send('FileExplorerAgent 测试服务器');
});

app.get('/api/files/*', (req, res) => {
  const path = req.params[0] || './';
  const files = fileExplorer.listFiles(path);
  res.json(files);
});

app.listen(port, () => {
  console.log(`服务器运行在 http://localhost:${port}`);
});